# coding=utf-8
import web
import pymongo


#db = web.database(dbn='mysql', db='webpyblog', user='root', pw='iloveyoujiaier')
conn = pymongo.Connection('localhost',27017)
database = conn['tuzibang']

def get_auto_id(name):
    return database.auto_id.find_and_modify(query={'name':name},update={'$inc':{'id':1}},new=True)['id']

web.config.debug = True

config = web.storage(
    site_domain="http://127.0.0.1:8080",
    email='killblank@gmail.com',
    site_name = '兔子帮',
    site_desc = '',
    siteroot="D:\\htdocs\\tuzibang\\tuzibang-webpy\\",
    static = '/static',
)

footer_links=[[u"兔子帮",[[u"挑衣服",config.site_domain+"/goods"],
                [u"看达人",config.site_domain+"/daren"],
                [u"逛店铺 ",config.site_domain+"/shop"],
                [u"兔子问答",config.site_domain+"/ask"],
                [u"兔子团购",config.site_domain+"/tuan"]]
                ],
        [u"获取帮助",[[u"新手指南",config.site_domain+"/helpcenter"],
                    [u"兔子客服",config.site_domain+"/helpcenter"],
                    [u"意见薄",config.site_domain+"/helpcenter"]]
        ],
        [u"关于我们",[[u"关于兔子帮",config.site_domain+"/helpcenter"],
                    [u"联系我们",config.site_domain+"/helpcenter"],
                    [u"加入兔子帮",config.site_domain+"/helpcenter"],
                    [u"广告投放与合作",config.site_domain+"/helpcenter"],
                    [u"隐私政策",config.site_domain+"/helpcenter"]]
        ],
        [u"更多",[[u"今日热门话题",config.site_domain+"/helpcenter"],
                [u"每周热门话题",config.site_domain+"/helpcenter",]]
        ] ,
        [u"关注我们",[[u"新浪微博",config.site_domain+"/helpcenter"],
                       [u"腾讯微博",config.site_domain+"/helpcenter"]]
        ]
     ]

#render = web.template.render('templates/',base="_layouts/default",cache=True)
admin_menus=[[u'首页',[[u'后台首页',u'/admin/default/main'],
                       [u'友情链接',u'/admin/link']]
              ],
              [u'内容',[[u'分类管理',u'/admin/catalog'],
                       [u'商品管理',u'/admin/goods'],
                       [u'评论管理',u'/admin/comment']]
              ],
              [u'用户',[[u'用户列表',u'/admin/user'],
                       [u'添加用户',u'/admin/user/edit']]
              ],
              [u'管理员',[[u'管理员列表',u'/admin/admin'],
                       [u'添加管理员',u'/admin/admin/edit']]
              ]
             ]

admin_config = web.storage(
    site_domain="http://www.duoduo.com",
    email='killblank@gmail.com',
    site_name = '兔子帮',
    site_desc = '',
    siteroot="D:\\htdocs\\tuzibang\\tuzibang-webpy\\",
    static = '/static',
    admin_menus=admin_menus,
)